package pl.pawluk.inz.entities;

import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 * User: mandp
 * Date: 17.05.13
 * Time: 19:39
 * To change this template use File | Settings | File Templates.
 */
public class StudentLectureEntityPK implements Serializable {
    private Long lectureId;

    @Id
    @Column(name = "lecture_id", nullable = false, insertable = true, updatable = true, length = 19, precision = 0)
    public Long getLectureId() {
        return lectureId;
    }

    public void setLectureId(Long lectureId) {
        this.lectureId = lectureId;
    }

    private Long studentId;

    @Id
    @Column(name = "student_id", nullable = false, insertable = true, updatable = true, length = 19, precision = 0)
    public Long getStudentId() {
        return studentId;
    }

    public void setStudentId(Long studentId) {
        this.studentId = studentId;
    }

    private Long subjectId;

    @Id
    @Column(name = "subject_id", nullable = false, insertable = true, updatable = true, length = 19, precision = 0)
    public Long getSubjectId() {
        return subjectId;
    }

    public void setSubjectId(Long subjectId) {
        this.subjectId = subjectId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        StudentLectureEntityPK that = (StudentLectureEntityPK) o;

        if (lectureId != null ? !lectureId.equals(that.lectureId) : that.lectureId != null) return false;
        if (studentId != null ? !studentId.equals(that.studentId) : that.studentId != null) return false;
        if (subjectId != null ? !subjectId.equals(that.subjectId) : that.subjectId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = lectureId != null ? lectureId.hashCode() : 0;
        result = 31 * result + (studentId != null ? studentId.hashCode() : 0);
        result = 31 * result + (subjectId != null ? subjectId.hashCode() : 0);
        return result;
    }
}
